/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multiface.promonet.jpa;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author diego
 */
@Entity
@Table(name = "mimetype")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Mimetype.findAll", query = "SELECT m FROM Mimetype m"),
    @NamedQuery(name = "Mimetype.findByIdmimetype", query = "SELECT m FROM Mimetype m WHERE m.idmimetype = :idmimetype"),
    @NamedQuery(name = "Mimetype.findByEstensione", query = "SELECT m FROM Mimetype m WHERE m.estensione = :estensione"),
    @NamedQuery(name = "Mimetype.findByTipo", query = "SELECT m FROM Mimetype m WHERE m.tipo = :tipo")})
public class Mimetype implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idmimetype")
    private Integer idmimetype;
    @Basic(optional = false)
    @Column(name = "estensione")
    private String estensione;
    @Basic(optional = false)
    @Column(name = "tipo")
    private String tipo;
    @Lob
    @Column(name = "icona")
    private byte[] icona;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "mimetype")
    private List<File> fileList;

    public Mimetype() {
    }

    public Mimetype(Integer idmimetype) {
        this.idmimetype = idmimetype;
    }

    public Mimetype(Integer idmimetype, String estensione, String tipo) {
        this.idmimetype = idmimetype;
        this.estensione = estensione;
        this.tipo = tipo;
    }

    public Integer getIdmimetype() {
        return idmimetype;
    }

    public void setIdmimetype(Integer idmimetype) {
        this.idmimetype = idmimetype;
    }

    public String getEstensione() {
        return estensione;
    }

    public void setEstensione(String estensione) {
        this.estensione = estensione;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public byte[] getIcona() {
        return icona;
    }

    public void setIcona(byte[] icona) {
        this.icona = icona;
    }

    @XmlTransient
    public List<File> getFileList() {
        return fileList;
    }

    public void setFileList(List<File> fileList) {
        this.fileList = fileList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmimetype != null ? idmimetype.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Mimetype)) {
            return false;
        }
        Mimetype other = (Mimetype) object;
        if ((this.idmimetype == null && other.idmimetype != null) || (this.idmimetype != null && !this.idmimetype.equals(other.idmimetype))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "multiface.promonet.jpa.Mimetype[ idmimetype=" + idmimetype + " ]";
    }
    
}
